package tacos.test;

import tacos.annotation.MyComonent;
import tacos.service.UserService;

import javax.annotation.Generated;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import java.lang.annotation.*;

public class Main {
    public static void main(String[] args) {
        Class<UserService> clazz = UserService.class;
        getAnnos(clazz);
    }

    private static void getAnnos(Class<?> clazz) {
        Annotation[] annotations = clazz.getAnnotations();
        for (Annotation annotation : annotations) {
            if (annotation.annotationType() != Deprecated.class &&
                    annotation.annotationType() != SuppressWarnings.class &&
                    annotation.annotationType() != Override.class &&
                    annotation.annotationType() != PostConstruct.class &&
                    annotation.annotationType() != PreDestroy.class &&
                    annotation.annotationType() != Resource.class &&
                    annotation.annotationType() != Generated.class &&
                    annotation.annotationType() != Target.class &&
                    annotation.annotationType() != Retention.class &&
                    annotation.annotationType() != Documented.class &&
                    annotation.annotationType() != Inherited.class) {
                if (annotation.annotationType() == MyComonent.class) {
                    System.out.println(" 存在注解 @MyComponent");
                } else {
                    getAnnos(annotation.annotationType());
                }
            }
        }
    }
}
